package ivo.util;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;


public class Printer {
	private Logger logger;
	
	public Printer(Class clazz){
		logger = Logger.getLogger(clazz);
	}
	
	public void info(String message){
		if(ServletActionContext.getContext() != null){
			message =  "[" + ServletActionContext.getRequest().getRemoteAddr() + "]:" + message;
		}
		logger.info(message);
	}
	
	public void debug(String message){
		if(ServletActionContext.getContext() != null){
			message =  "[" + ServletActionContext.getRequest().getRemoteAddr() + "]:" + message;
		}
		
		logger.debug(message);
	}
	
	public void error(String message){
		if(ServletActionContext.getContext() != null){
			message =  "[" + ServletActionContext.getRequest().getRemoteAddr() + "]:" + message;
		}
		logger.error(message);
	}

}
